package com.qf.service.impl;

import com.qf.dao.Bookdao;
import com.qf.dao.impl.BookDaoImpl;
import com.qf.entity.Book;
import com.qf.entity.Page;
import com.qf.service.BookService;

import java.util.List;

/**
 * @author Wy
 * @version V1.0
 * @Project day41-3
 * @Package com.qf.service.impl
 * @Description:
 * @Date 2022/5/14 13:17
 */
public class BookServiceImpl implements BookService {
      private Bookdao bookdao=  new BookDaoImpl();
    @Override
    public List<Book> getAll() {
       return bookdao.selectAll();
    }

    @Override
    public boolean addBook(Book book) {
        return bookdao.addOne(book)>0;
    }

    @Override
    public int deleteBook(String bookId) {
      return   bookdao.deleteBook(bookId);

    }

    @Override
    public int updatebooks(Book book, String BookId) {
        return bookdao.uppdateBook(book,BookId);
    }

    @Override
    public Book getBook(String bookId) {
        return bookdao.selectOne(bookId);
    }

    @Override
    public List<Book> findAllPage(Page page) {
        List<Book> list = bookdao.selectAllByPage(page);
        return list;
    }

    @Override
    public int findAllPageCount() {
        int count = bookdao.selectAllByPageCount();
        return count;
    }

}
